package cn.bgs.controller;

import cn.bgs.page.PageRequest;
import cn.bgs.pojo.TopUp;
import cn.bgs.service.BillService;
import cn.bgs.utils.R;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Bill")
public class BillController {
    @Autowired
    private BillService billService;
    @GetMapping("/billSelect")
    public PageInfo<TopUp> billSelect(PageRequest pageRequest, String userName){
        PageInfo<TopUp> allUser = billService.billSelect(pageRequest,userName);
        return allUser;
    }
    @GetMapping("/userNameSelect")
    public R userNameSelect(){
        return billService.userNameSelect();
    }
    @GetMapping("/billDelete")
    public R billDelete(Integer topUpId){
        return billService.billDelete(topUpId);
    }
    @PostMapping("/billAdd")
    public R billAdd(@RequestBody TopUp topUp){
        return billService.billAdd(topUp);
    }
    @PostMapping("/billUpdate")
    public R billUpdate(@RequestBody TopUp topUp){
        return billService.billUpdate(topUp);
    }
}
